- /* sdmtkout.cpp by K.Tsuru */
- // function ID 356 DRADIX, BRADIX
- /***********************************************************
- SDouble, SDecimal class
- Ver 1.02
- It makes an approximated value taking first "fig" figures.
- ************************************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- SDouble SDouble::TakeOutFigures(uint fig) const{
- if(Sign(356) == 0) return SDZero(*this);
- uint n_copy = min(fig+aTail, aHead+1u), sz, cm = CurrentMaxSize();
- if(n_copy >= cm) n_copy = (Type() == REAL) ? (cm -1u) : cm;
-
- if(Type() == REAL) sz = n_copy;
- else sz = MaxSize(); // SDecimal class
-
- SDouble r(Type(), 0);
- r.valloc(sz, -1);
- fType* rv = r.figure.Elements();
- #ifndef NDEBUG
- r.figure(n_copy-1);
- #endif
- memcpy(rv, ReadFigures(), n_copy*sizeof(fType));
- r.figure.clear(n_copy);
-
- uint i = 0;
- while(!rv[i] && (i < n_copy)) i++;
- if((i == n_copy) && !rv[i-1]) return SDZero(*this);
- r.aTail = i;
- i = n_copy-1;
- while(!rv[i]) i--;
- r.aHead = i;
- r.SetRdxExp(rdxExp);
- r.SetSign(Sign());
- return r;
- }
sdmtkout.cpp : last modifiled at 2017/03/13 14:31:58(1,081 bytes)
created at 2017/10/07 10:21:14
The creation time of this html file is 2017/10/07 10:30:03 (Sat Oct 07 10:30:03 2017).